/* ****************************************************************
   ****************************************************************
   * Com++ Professional (c) 2009 C++ World
   * http://www.cplusplusworld.com/ mailto:compp@cplusplusworld.com
   ****************************************************************
   ****************************************************************
*/

#ifndef  ASRV_H
#define  ASRV_H

#include "ComPlusPlus/SocketUdp.h"
#include "ComPlusPlus/Thread.h"
#include "ComPlusPlus/ASrvContext.h"
namespace compp {
class ASrv : public compp::Thread {

 public:
  ASrv( );
  ASrv( const int port );
  ASrv( const std::string & IPAddr, const int port );
  virtual~ASrv( );

  void Broadcast (const bool BC ) ;
  void AddMultiCastGroup (const std::string & IPAddr ) ;

  void commenceWork ();
  void setPort ( const int p ) { port = p ;}
  void setIPAddr ( const std::string & s ) { IPAddr = s ; }

  virtual std::string  executeTransaction (  const std::string & request, ASrvContext & Context );
  
  void *Run (void*v);
  
 protected:

  std::string IPAddr;
  int port;
  compp::SocketUdp Server ;

};
}

#endif
